<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Location对象</title>

</head>
<body>
<input type="button" id="btn" value="刷新">
<input type="button" id="btn2" value="跳转百度">
</body>

<script>
        //reload方法 定义一个按钮
        //1.获取按钮对象
        var b = document.getElementById("btn");
        var b2 = document.getElementById("btn2");
        //2.绑定事件
        b.onclick = function(){
        //3.刷新
            location.reload();
        }


        b2.onclick = function(){
            location.href = "https://www.baidu.com";
        }

        var href = location.href;
        alert(href);
</script>

</html>